(0) Obligation:

Clauses:

goal(X) :- ','(s2t(X, T), tree(T)).
tree(nil) :- !.
tree(X) :- ','(left(T, L), ','(right(T, R), ','(tree(L), tree(R)))).
s2t(0, L) :- ','(!, eq(L, nil)).
s2t(X, node(T, X1, T)) :- ','(p(X, P), s2t(P, T)).
s2t(X, node(nil, X2, T)) :- ','(p(X, P), s2t(P, T)).
s2t(X, node(T, X3, nil)) :- ','(p(X, P), s2t(P, T)).
s2t(X, node(nil, X4, nil)).
left(nil, nil).
left(node(L, X5, X6), L).
right(nil, nil).
right(node(X7, X8, R), R).
p(0, 0).
p(s(X), X).
eq(X, X).

Query: goal(g)

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph DT10.

(2) Obligation:

Triples:

s2tA(s(X1), node(X2, X3, X2)) :- s2tA(X1, X2).
s2tA(s(X1), node(nil, X2, X3)) :- s2tA(X1, X3).
s2tA(s(X1), node(X2, X3, nil)) :- s2tA(X1, X2).
pD :- treeB.
pD :- ','(treecB, treeB).
pE(X1, X2) :- treeC(X1).
pE(X1, X2) :- ','(treecC(X1), treeC(X2)).
goalF(0) :- treeB.
goalF(s(X1)) :- s2tA(X1, X2).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pD).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pE(X3, X4)).
goalF(s(X1)) :- s2tA(X1, X2).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pD).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pE(X3, X4)).
goalF(s(X1)) :- s2tA(X1, X2).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pD).
goalF(s(X1)) :- ','(s2tcA(X1, X2), pE(X3, X4)).
goalF(X1) :- pD.
goalF(X1) :- pE(X2, X3).

Clauses:

s2tcA(0, nil).
s2tcA(s(X1), node(X2, X3, X2)) :- s2tcA(X1, X2).
s2tcA(s(X1), node(nil, X2, X3)) :- s2tcA(X1, X3).
s2tcA(s(X1), node(X2, X3, nil)) :- s2tcA(X1, X2).
s2tcA(X1, node(nil, X2, nil)).
treecB.
treecC(nil).
qcD :- ','(treecB, treecB).
qcE(X1, X2) :- ','(treecC(X1), treecC(X2)).

Afs:

goalF(x1)  =  goalF(x1)

(3) UndefinedPredicateInTriplesTransformerProof (SOUND transformation)

Deleted triples and predicates having undefined goals [DT09].

(4) Obligation:

Triples:

s2tA(s(X1), node(X2, X3, X2)) :- s2tA(X1, X2).
s2tA(s(X1), node(nil, X2, X3)) :- s2tA(X1, X3).
s2tA(s(X1), node(X2, X3, nil)) :- s2tA(X1, X2).
goalF(s(X1)) :- s2tA(X1, X2).
goalF(s(X1)) :- s2tA(X1, X2).
goalF(s(X1)) :- s2tA(X1, X2).

Clauses:

s2tcA(0, nil).
s2tcA(s(X1), node(X2, X3, X2)) :- s2tcA(X1, X2).
s2tcA(s(X1), node(nil, X2, X3)) :- s2tcA(X1, X3).
s2tcA(s(X1), node(X2, X3, nil)) :- s2tcA(X1, X2).
s2tcA(X1, node(nil, X2, nil)).
treecB.
treecC(nil).
qcD :- ','(treecB, treecB).
qcE(X1, X2) :- ','(treecC(X1), treecC(X2)).

Afs:

goalF(x1)  =  goalF(x1)

(5) TriplesToPiDPProof (SOUND transformation)

We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:
goalF_in: (b)
s2tA_in: (b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

GOALF_IN_G(s(X1)) → U4_G(X1, s2tA_in_ga(X1, X2))
GOALF_IN_G(s(X1)) → S2TA_IN_GA(X1, X2)
S2TA_IN_GA(s(X1), node(X2, X3, X2)) → U1_GA(X1, X2, X3, s2tA_in_ga(X1, X2))
S2TA_IN_GA(s(X1), node(X2, X3, X2)) → S2TA_IN_GA(X1, X2)
S2TA_IN_GA(s(X1), node(nil, X2, X3)) → U2_GA(X1, X2, X3, s2tA_in_ga(X1, X3))
S2TA_IN_GA(s(X1), node(nil, X2, X3)) → S2TA_IN_GA(X1, X3)
S2TA_IN_GA(s(X1), node(X2, X3, nil)) → U3_GA(X1, X2, X3, s2tA_in_ga(X1, X2))
S2TA_IN_GA(s(X1), node(X2, X3, nil)) → S2TA_IN_GA(X1, X2)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
s2tA_in_ga(x1, x2)  =  s2tA_in_ga(x1)
node(x1, x2, x3)  =  node(x1, x3)
nil  =  nil
GOALF_IN_G(x1)  =  GOALF_IN_G(x1)
U4_G(x1, x2)  =  U4_G(x1, x2)
S2TA_IN_GA(x1, x2)  =  S2TA_IN_GA(x1)
U1_GA(x1, x2, x3, x4)  =  U1_GA(x1, x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x1, x4)

We have to consider all (P,R,Pi)-chains

Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

GOALF_IN_G(s(X1)) → U4_G(X1, s2tA_in_ga(X1, X2))
GOALF_IN_G(s(X1)) → S2TA_IN_GA(X1, X2)
S2TA_IN_GA(s(X1), node(X2, X3, X2)) → U1_GA(X1, X2, X3, s2tA_in_ga(X1, X2))
S2TA_IN_GA(s(X1), node(X2, X3, X2)) → S2TA_IN_GA(X1, X2)
S2TA_IN_GA(s(X1), node(nil, X2, X3)) → U2_GA(X1, X2, X3, s2tA_in_ga(X1, X3))
S2TA_IN_GA(s(X1), node(nil, X2, X3)) → S2TA_IN_GA(X1, X3)
S2TA_IN_GA(s(X1), node(X2, X3, nil)) → U3_GA(X1, X2, X3, s2tA_in_ga(X1, X2))
S2TA_IN_GA(s(X1), node(X2, X3, nil)) → S2TA_IN_GA(X1, X2)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
s2tA_in_ga(x1, x2)  =  s2tA_in_ga(x1)
node(x1, x2, x3)  =  node(x1, x3)
nil  =  nil
GOALF_IN_G(x1)  =  GOALF_IN_G(x1)
U4_G(x1, x2)  =  U4_G(x1, x2)
S2TA_IN_GA(x1, x2)  =  S2TA_IN_GA(x1)
U1_GA(x1, x2, x3, x4)  =  U1_GA(x1, x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x1, x4)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 5 less nodes.

(8) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

S2TA_IN_GA(s(X1), node(nil, X2, X3)) → S2TA_IN_GA(X1, X3)
S2TA_IN_GA(s(X1), node(X2, X3, X2)) → S2TA_IN_GA(X1, X2)
S2TA_IN_GA(s(X1), node(X2, X3, nil)) → S2TA_IN_GA(X1, X2)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
node(x1, x2, x3)  =  node(x1, x3)
nil  =  nil
S2TA_IN_GA(x1, x2)  =  S2TA_IN_GA(x1)

We have to consider all (P,R,Pi)-chains

(9) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(10) Obligation:

Q DP problem:
The TRS P consists of the following rules:

S2TA_IN_GA(s(X1)) → S2TA_IN_GA(X1)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(11) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • S2TA_IN_GA(s(X1)) → S2TA_IN_GA(X1)
    The graph contains the following edges 1 > 1

(12) YES